package com.yiqi.lottery.feature.find.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.suozhang.framework.entity.bo.PageData;
import com.yiqi.lottery.entity.bo.BaseBo;
import com.yiqi.lottery.entity.bo.CircleBo;
import com.yiqi.lottery.entity.bo.FoucsBo;
import com.yiqi.lottery.feature.find.contract.CircleContract;
import com.yiqi.lottery.feature.find.dependencies.circle.DaggerCircleModelComponent;
import com.yiqi.lottery.feature.login.dependencies.login.DaggerLoginModelComponent;
import com.yiqi.lottery.framework.api.ApiLib;
import com.yiqi.lottery.framework.api.FindApi;
import io.reactivex.Observable;

import javax.inject.Inject;

public class CircleModel implements CircleContract.Model {

    @Inject
    FindApi api;


    @Inject
    public CircleModel() {

        DaggerCircleModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<PageData<CircleBo>> getCircleList(int page, int post_type, int type) {
        return api.findCircleGet(page,post_type,type).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<PageData<CircleBo>> getMyCircleList(int page) {
        return api.findCircleMine(page).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<FoucsBo> getFoucedDetail(String id) {
        return api.getFoucsDetail(id).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> dianZan(BaseBo baseBo) {
        return api.dianZan(baseBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> cancleDianzan(Integer id) {
        return api.cancleDianZan(id).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> getJiaodian() {
        return api.getJiaddian().compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> getZhongJiang() {
        return api.getZhongjiang().compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
